<?php
class SyssiteAction extends BaseAction{
	
	public function index(){
		
		$this->vo = D('Syssite')->find('1');
		$this->display();
	}
	
	public function update(){
		// 保存编辑过的数据 
		$Dao = D("Syssite"); 
		$vo = $Dao->create("","edit");
		
 		if(!empty($_FILES['file1']['name'])){
            //添加附件
            import("ORG.Net.UploadFile");
            $upload = new UploadFile();
            $upload->maxSize  = 32922000;
            $upload->allowExts  = explode(',','pdf,caj,rar,zip,doc,exl,txt,jpg,gif');
            $upload->savePath = './Public/file/';

            //执行上传操作
            $result = $upload->upload();
			
			
            if($result){
				$result = $upload->getUploadFileInfo();

				$DaoAttach = D("Sysattach"); 
				$vo2 = $DaoAttach->create($result[0]); 
				if(false === $vo2) { 
					$this->error($DaoAttach->getError()); 
				} 
				$rs = $DaoAttach->add(); 
				
				$file	=	$result[0]['savepath'].$result[0]['savename'];
				$this->assign('done','上次成功!');
				if($Dao->logoUrl) unlink($Dao->logoUrl);//删除原来的LOGO
				$Dao->logoUrl = $result[0]['savename'];
			}
        }else{
			$this->assign('done','没有上传,请确认选择文件!');
		}

		if(false === $vo) { 
	 		$this->error($Dao->getError()); 
		} 
 
		$rs = $Dao->save(); 
		if($rs){ 
			$this->assign("jumpUrl",__URL__); 
			$this->success("保存修改成功!"); 
		}else{ 
			$this->error("保存修改失败"); 
		} 
	}
	




}
?>